package cn.tianyigps.tianyigpsapiv2.param.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Created with IDEA
 * author:guibin.cui
 * Date:2018/5/16
 * Time:15:33
 * 传送数据父类,其他DTO
 */
@Setter
@Getter
@NoArgsConstructor
@JsonInclude(value=JsonInclude.Include.NON_NULL)
public class PageDTO<T> {

    // 页码
    private Integer page = 1;
    // 每页条数
    private Integer pageNum = 10;
    // 跳过条数
    private Integer skipNum ;
    //总条数
    private Long count;
    // 数据
    private T data;

    public PageDTO(int page, int pageNum){
        this.page = page;
        this.pageNum = pageNum;
        this.skipNum = pageNum * (page - 1);
    }

    public Integer getSkipNum() {
        Integer skipNum = pageNum * (page - 1);
        return skipNum;
    }
}
